/**
 * Created by 3dgis on 2017/4/4.
 */
import axios from "axios"

export function search(){
    return function(dispatch){
        dispatch({type:"FETCH_SEARCH_RESULT"});
        axios.get('http://map.tianditu.com/query.shtml?postStr={"keyWord":"天安门","level":"12","mapBound":"-180,-90,180,90","queryType":"1","start":"0","count":"10"}&type=query')
            .then((response)=>{
                dispatch({type:"RECEIVE_SEARCH_RESULT",payload:response.data})
            })
            .catch((err)=>{
                dispatch({type:"FETCH_RESULT_ERROR",payload:err})
            })
    }
}